# -*- coding: utf-8 -*-
# @Time : 2021/2/3 上午 12:24
# @Author : lijunlong
# @Email : 729619494@qq.com
# @File : test_clientsearch_ture.py
# @Project : test0

from selenium.webdriver.common.by import By
from pages.base_page import BasePage

class LoginPage(BasePage):
    """定义登录页面"""
    url_ = "http://192.168.1.14/crm/index.php?m=user&a=login"
    username_locator = (By.NAME,"name")
    password_locator = (By.NAME,"password")
    submit_locator = (By.NAME,"submit")


    def username(self,username):
        return self.driver.find_element(*self.username_locator).send_keys(username)

    def password(self,password):
        return self.driver.find_element(*self.password_locator).send_keys(password)

    def submit(self):
        return self.findE(self.submit_locator).click()

    def open(self):
        self.driver.get(self.url)

    def login(self,username,password):
        self.open()
        self.username(username)
        self.password(password)
        self.submit()

